#include "ConstructorNode.h"

#include "Output/Console.h"

#include "ScriptCompiler/Token/Token.h"
#include "ScriptCompiler/AST/ParameterNode.h"
#include "ScriptCompiler/AST/SentenceBlockNode.h"
#include "ScriptCompiler/AST/FunctionContentNode.h"

#include "ExpressionNode.h"

void CConstructorNode::DebugPrint(int32_t InDepth)
{
    for(int32_t i=0;i<InDepth;i++)
    {
        WH::Print(U"\t");
    }

    WH::Print(Name->ToString());
    WH::Print(U"(");

    for(int32_t i=0;i<Parameters.Num();i++)
    {
        Parameters[i]->DebugPrint(0);
        if(i!=Parameters.Num()-1)
        {
            WH::Print(U",");
        }
    }

    WH::Print(U")");

    
    WH::Print(U": base (");
    //print base constructor arguments
    for(int32_t i=0;i<BaseConstructorArguments.Num();i++)
    {
        BaseConstructorArguments[i]->DebugPrint(0);
        if(i!=BaseConstructorArguments.Num()-1)
        {
            WH::Print(U",");
        }
    }
    WH::Print(U")");
    WH::Print(U"\n");


    if(Content.HasValue())
    {
        Content.GetValue()->DebugPrint(InDepth);
    }

}

std::shared_ptr<CScriptToken> CConstructorNode::GetFirstToken()
{
    return Name;
}
